import http from './http'

// 车间管理API
export const workshopApi = {
  // 分页查询车间信息
  getWorkshopsPage(params) {
    return http({
      url: '/database/workshops/page',
      method: 'get',
      params
    })
  },

  // 根据ID查询车间信息
  getWorkshopById(id) {
    return http({
      url: `/database/workshops/${id}`,
      method: 'get'
    })
  },

  // 添加车间信息
  addWorkshop(data) {
    return http({
      url: '/database/workshops',
      method: 'post',
      data
    })
  },

  // 生成车间编号
  generateWorkshopCode() {
    return http({
      url: '/database/workshops/generate-code',
      method: 'get'
    })
  },

  // 更新车间信息
  updateWorkshop(data) {
    return http({
      url: '/database/workshops',
      method: 'put',
      data
    })
  },

  // 删除车间信息
  deleteWorkshopById(id) {
    return http({
      url: `/database/workshops/${id}`,
      method: 'delete'
    })
  }
}
